#!/usr/bin/env python
# encoding: utf-8
'''
@author: liuchong
@contact: lucas@007vin.com
@software: garner
@file: banzhou.py
@time: 2020/9/9 2:44 下午
@desc:
'''

import ujson
def getSacode(sacodes):
    sa_codes = sacodes or '{}'
    sa_codes = ujson.loads(sa_codes)
    for key, value in sa_codes.items():
        if value:
            sa_codes = sa_codes + value
    return sa_codes

def cleanTransmission(key):
    key = key.replace('三', '3')
    key = key.replace('四', '4')
    key = key.replace('五', '5')
    key = key.replace('六', '6')
    key = key.replace('七', '7')
    key = key.replace('八', '8')
    key = key.replace('档', '挡')
    if key == '5挡自动':
        key = '5挡AMT'
    if key == '6挡自动':
        key = '6挡AMT'
    if key == '7挡自动':
        key = '7挡AMT'
    if key == '7档双离合':
        key = '7档AMT'
    if key == '8挡自动':
        key = '8挡AMT'
    if key == '无级自动':
        key = 'CVT无级变速(模拟6挡),CVT无级变速(模拟7挡),CVT无级变速(模拟8挡)'
    return key

def cleanDrive(key):
    key = key.replace('前驱动', '两驱')
    key = key.replace('前部驱动', '两驱')
    key = key.replace('四轮驱动', '四驱')
    key = key.replace('全轮驱动', '四驱')
    return key

def cleanCylinder(key):
    key = key.replace('二缸', '2')
    key = key.replace('2缸', '2')
    key = key.replace('三缸', '3')
    key = key.replace('3缸', '3')
    key = key.replace('四缸', '4')
    key = key.replace('4缸', '4')
    key = key.replace('五缸', '5')
    key = key.replace('5缸', '5')
    key = key.replace('六缸', '6')
    key = key.replace('6缸', '6')
    key = key.replace('八缸', '8')
    key = key.replace('8缸', '8')
    key = key.replace('十缸', '10')
    key = key.replace('10缸', '10')
    key = key.replace('十二缸', '12')
    key = key.replace('12缸', '12')
    return key

def cleanPower(key):
    key = key.replace('KW', '')
    return key